package com.twxm.breed.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;

import java.util.Date;

@Data
@Table(name = "waterfactor")
public class WaterFactor implements FactorImpl{
    @IsKey
    @TableId
    @IsAutoIncrement
    private int waterId;

    @Column(comment = "水温",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float waterTemperature;

    @Column(comment = "PH",name = "PH",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float PH;

    @Column(comment = "氨氮",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float ammoniaNitrogen;

    @Column(comment = "总氮",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float totalNitrogen;

    @Column(comment = "总磷",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float totalPhosphorus;

    @Column(comment = "高锰酸钾",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float permanganate;

    @Column(comment = "亚硝酸盐",type = MySqlTypeConstant.FLOAT,decimalLength = 2)
    @IsNotNull
    private float nitrite;

    @Column(comment = "采集时间" ,type = MySqlTypeConstant.DATETIME)
    @IsNotNull
    private Date collectionTime;

    @Column(name = "pond_id",type = MySqlTypeConstant.VARCHAR)
    @IsNotNull
    private FishPond fishPond;

    public WaterFactor(Date date, float waterTemperature, float ph, float ammoniaNitrogen, float totalNitrogen, float totalPhosphorus, float permanganate, float nitrite, FishPond fishPond) {
        this.collectionTime = date;
        this.PH = ph;
        this.waterTemperature = waterTemperature;
        this.ammoniaNitrogen = ammoniaNitrogen;
        this.totalNitrogen = totalNitrogen;
        this.totalPhosphorus = totalPhosphorus;
        this.permanganate = permanganate;
        this.nitrite = nitrite;
        this.fishPond = fishPond;
    }


    @Override
    public float getContent(String el) {
        switch (el){
            case "PH":
                return PH;
            case  "waterTemperature":
                return waterTemperature;
            case "ammoniaNitrogen":
                return ammoniaNitrogen;
            case "totalNitrogen":
                return totalNitrogen;
            case "totalPhosphorus":
                return totalPhosphorus;
            case "permanganate":
                return permanganate;
            case "nitrite":
                return nitrite;
            default:
                return 0;
    }}
}
